package com.igeek.oop.pojo;

import com.igeek.oop.dao.Info;

import java.util.Scanner;

/**
 * 父类
 */
public class Person {

    /**
     * 按门铃
     * @param door
     */
    public void ringBell(ElectronicDoor door){

        //判断状态
        if(door.isOn()){
            System.out.println("门已开");
        }else{
            if(!door.isDoorbell()){
                door.setDoorbell(true);
                System.out.println("门铃已响");
            }else{
                System.out.println("一直在响");
            }
        }
    }

    /**
     * 录入信息同时校验信息
     */
    public boolean putCheckInfo(Computer computer){
        System.out.println("请输入用户名、密码，或者是录入指纹：");
        Scanner scanner = new Scanner(System.in);

        String username = scanner.next();
        String password = scanner.next();

        Info info = new Info();
        info.setUsername(username);
        info.setPassword(password);

        return computer.checkInfo(info);
    }
}
